<template>
    <div class="right vipLevel">
        <div class="level_tit tit clearfix">
            <span class="pull-left">商品回收站</span>
        </div>
        <table class="table table-striped" id="level">
            <thead>
                <th>ID编号</th>
                <th>产品</th>
                <th>名称</th>
                <th>删除时间</th>
                <th>操作</th>
            </thead>
            <tbody>
               <tr v-for='(obj,ind) in data'>
                    <td>{{ind+1}}</td>
                    <td>{{obj.name}}</td>
                    <td>{{obj.name}}</td>
                    <td>{{obj.delTime}}</td>
                    <td>
                        <span v-on:click="recover(ind)">恢复</span>
                        <span v-on:click="remove(ind)">彻底删除</span>
                    </td>
               </tr>
            </tbody>
        </table>
    </div>
</template>
<script>
console.log(getStorage("del"))
    import getStorage from "../js/getStorage"
    export default {
        data(){
            return{
                data:getStorage("del")
            }
        },
        methods:{
            remove(ind){
                this.data.splice(ind,1);
                localStorage.del = JSON.stringify(this.data);
            },
            recover(ind){
                this.data.splice(ind,1);
                localStorage.del = JSON.stringify(this.data);
            }
        },
        watch:{
            data(val,oldVal){}
        }
    }
</script>
<style lang="css" scoped>
    .level_tit{
        background:url("../images/list_icon_03.jpg") 5px 25px no-repeat;
        padding-bottom:10px;
        font-weight:normal;
    }
    td span{
        cursor:pointer;
    }
</style>